#include <iostream>
#include <string>
#include <mysql/mysql.h>


int main(int argc, char** argv)
{
    MYSQL mysql;
    mysql_library_init(0, nullptr, nullptr);
    mysql_init(&mysql);


    std::string host = "127.0.0.1";
    std::string user = "mysql_test";
    std::string pass = "123456";
    std::string db   = "mysql";

    // unix_socket : 
    // cliebt_flag 本次链接的操作:  CLIENT_OPTIONAL_RESULTSET_METADATA 返回表结构信息; 
    if (nullptr== mysql_real_connect(&mysql, host.c_str(), user.c_str(), pass.c_str(), db.c_str(), 3306, nullptr, 0))
    {
        std::cout << "mysql connect  fialed!" << mysql_error(&mysql) << std::endl;
    }

    std::cout << "mysql client " << std::endl;

    mysql_close(&mysql);
    mysql_library_end();


    return 0;
}